import 'dart:async';

import 'package:bloc/bloc.dart';
import 'package:meta/meta.dart';

part 'main_page_event.dart';

part 'main_page_state.dart';

class MainPageBloc extends Bloc<MainPageEvent, MainPageState> {
  MainPageBloc() : super(MainPageState().init());

  @override
  Stream<MainPageState> mapEventToState(MainPageEvent event) async* {
    if(event is MainPageListEvent){
      yield state.clone()..list=List.filled(30, false);
    }else if(event is MainPageLikeEvent){
      yield state.clone()..list[event.position]=event.isLike;
    }
  }
}
